<template>
  <div class="city">
    <city-header></city-header>
    <city-list @cityName="cityName" :hotCities="hotCities" :cities="cities"></city-list>
  </div>
</template>

<script>
  import CityHeader from "./pages/Header"
  import CityList from "./pages/List"

  export default {
    data(){
      return{
        hotCities:[],
        cities:{}
      }
    },
    components:{
        CityHeader,
        CityList
      },
    mounted(){
      this.$http({
        url:"http://www.jizhuangzhuang.com/mobiles/fitness/static/server/getcity.php"
      }).then(res=>{
        this.hotCities = res.data.data.hotCities;
        this.cities = res.data.data.cities;
      }).catch(err=>{
        console.log("error is" + err)
      })
    },
    methods:{
      cityName(data){
        this.$emit("cityName",data)
      }
    }
    }
</script>

<style scoped>

</style>
